#ifndef HAND_H
#define HAND_H
#include "card.h"

#include <string>
#include <list>

//class created by NA Molapo
//edited by CP Botha
//edited by AB Arakkal
/*!
 * \brief The Hand class a class to represent any collection of cards. This could be a player hand a trick or a collection of cards that were already played
 */
class Hand
{

public:
    /*!
     * \brief Hand hand constructor
     */
    Hand();
    ~Hand();
    /*!
     * \brief addCard add card to hand
     * \param c card object to be added to hand
     */
    void addCard(Card c);           //adds card to hand
    /*!
     * \brief removeCard remove card from hand
     * \param c card object to be removed from hand
     */
    void removeCard(Card c);        //removes card from hand
    /*!
     * \brief getCardIndex return card index of a card belonging to a owner id
     * \param id owner id
     * \return return
     */
    int getCardIndex(int id);       // returns index of card ID
    /*!
     * \brief getCard returns pointer to card at index
     * \param index of card pointer
     * \return card pointer
     */
    Card* getCard(int index);    // returns card found at index
    /*!
     * \brief getMaxCard returns pointer to biggest card in hand
     * \return card pointer
     */
    Card* getMaxCard();          //returns max card
    /*!
     * \brief getMinCard returns pointer to smallest card in hand
     * \return card pointer
     */
    Card* getMinCard();
    /*!
     * \brief determineWinner returns owner id of biggest card in han
     * \return int id of owner
     */
    int determineWinner();      //returns owner of trick winner
    /*!
     * \brief numberOfSuit return number of cards in hand of a suit
     * \param s suit to search
     * \return int number of cards in that suit
     */
    int numberOfSuit(char s);
    /*!
     * \brief print hand to command line for debugging
     */
    void print();
    /*!
     * \brief getHandSize return size of hand
     * \return int size of hand
     */
    int getHandSize();                  //returns number of cards in hand
    /*!
     * \brief updateHandInfo set score,balanced and longestSuit. Call after all cards have been added
     */
    void updateHandInfo();              //set score,balanced and longestSuit
    /*!
     * \brief calcHandScore return hand score based on 4-3-2-1 point count
     * \return int hand score
     */
    int calcHandScore();                //return hand score based on 4-3-2-1 point count
    /*!
     * \brief cards list of card objects
     */
    list <Card> cards;
    /*!
     * \brief getHandScore returns hand score
     * \return int containing hand score
     */
    int getHandScore();
    /*!
     * \brief isBalanced determine if score is balaced
     * \return returns bool showing if hand is balanced of not
     */
    bool isBalanced();
    /*!
     * \brief getLongestSuit returs suit of longest suit in hand
     * \return char containing longest suit
     */
    char getLongestSuit();
    /*!
     * \brief updateOwner update hand owner
     * \param int containing owiner id
     */
    void updateOwner(int);
    /*!
     * \brief sortHand sort the hand
     */
    void sortHand();

    private:
        int score;
        bool balanced;
        char longestSuit;
};

#endif // HAND_H
